#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2021, Intel Corporation
#
#
# libpmempool_bttdev/TEST6 -- test for checking btt
#

. ../unittest/unittest.sh

require_test_type medium
require_fs_type any
require_unlimited_vm

# Valgrind cannot trace more than 32G which is required for this test
configure_valgrind memcheck force-disable

setup

POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG
EXE=../libpmempool_api/libpmempool_test

truncate -s2T $POOL
expect_normal_exit $BTTCREATE -s 2T -b 512M -t $POOL >> $LOG

$PMEMSPOIL $POOL "bttdevice.arena(0).btt_info.sig=ERROR"\
	"bttdevice.arena(0).btt_info_backup.sig=ERROR"\
	"bttdevice.arena(1).btt_info.sig=ERROR"\
	"bttdevice.arena(1).btt_info_backup.sig=ERROR"\
	"bttdevice.arena(2).btt_info.sig=ERROR"\
	"bttdevice.arena(2).btt_info_backup.sig=ERROR"\
	"bttdevice.arena(3).btt_info.checksum=13"

expect_normal_exit $EXE$EXESUFFIX -r 1 -t btt $POOL >> $LOG

check_file $POOL

check

pass
